package com.gzsxy.factory.method;

import com.gzsxy.factory.Coffee;

/**
 * @author xiaolong
 * @version 1.0
 * @description: 客户购买（完全遵循开闭原则）
 * @date 2022/4/10 19:28
 */
public class Client {
    public static void main(String[] args) {
        //咖啡店
        CoffeeStore coffeeStore = new CoffeeStore();
        // CoffeeFactory factory = new AmericanCoffeeFactory();
        //拿铁咖啡
        CoffeeFactory factory = new LatteCoffeeFactory();
        coffeeStore.setFactory(factory);
        Coffee coffee = coffeeStore.orderCoffee();
        System.out.println(coffee.getName());
    }
}
